package com.sky.mapper;

import com.sky.entity.DishFlavor;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {
    /**
     * 批量插入口味信息
     * @param flavors 配料信息
     */
    void insertBatch(List<DishFlavor> flavors);

    /**
     * 根据菜品id删除口味信息
     * @param dishId 菜品id
     */
    @Delete("DELETE FROM dish_flavor WHERE dish_id = #{dishId}")
    void deleteByDishId(Long dishId);


    /**
     * 根据菜品id集合批量删除口味信息
     * @param dishIds 菜品id集合
     */
    void deleteByDishIds(List<Long> dishIds);

    /**
     * 根据菜品id获取口味信息  --可能有多个
     * @param dishId 菜品id
     * @return 口味信息
     */
    @Select("SELECT * FROM dish_flavor WHERE dish_id = #{dishId}")
    List<DishFlavor> getByDishId(Long dishId);
}
